namespace :bash do
  task :chown do
    on roles :all do
      within release_path do
        execute :chown, '-R', fetch(:chown_users), '.'
      end
    end
  end

  task :restart_php do
    on roles fetch(:php_fpm_roles) do
      within release_path do
        execute :service, 'php-fpm', 'reload'
      end
    end
  end
end

namespace :load do
  task :defaults do
    set :chown_users, 'apache:apache'
    set :php_fpm_roles, 'web'
  end
end
